package com.lanyou.cook.config;

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.embedded.MimeMappings;
import org.springframework.stereotype.Component;

@Component
public class ServletCustomizer implements EmbeddedServletContainerCustomizer {

	@Override
	public void customize(ConfigurableEmbeddedServletContainer container) {
		MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
		mappings.add("dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template");
		mappings.add("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
		mappings.add("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
		mappings.add("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation");
		mappings.add("doc", "application/msword");
		mappings.add("dot", "application/msword");
		mappings.add("xls", "application/vnd.ms-excel");

		container.setMimeMappings(mappings);
	}
}
